<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>every和some</title>
</head>
<body>
    <script>
        let arr = ['sffd','djskf'];

        // every有一个为false就直接结束返回false，所有的都为true才返回true
        let res1 = arr.every(function (value,index,arr) {
            console.log(value);
            return true;
        })
        console.log(res1);

        // some有一个返回true就直接结束返回true，所有的都为false才返回false
        let res2 = arr.some(function (value,index,arr) {
            console.log(value);
            return false;
        })
        console.log(res2);


        let score = [
            {name:"张三",score:99},
            {name:"李四",score:78},
            {name:"王五",score:55},
        ];

        let score1 = score.every(function (value) {
            return value.score >= 60;
        });
        let tag1 = score1 ? '所有人都及格':'有人没有及格';
        console.log(tag1);

        
        let score2 = score.some(function (value) {
            return value.score < 60;
        });
        let tag2 = score2 ? '有人没有及格':'所有人都及格';
        console.log(tag2);
    </script>
</body>
</html>